public class Pawn extends ChessPiece {
	private final static int PAWN_VALUE = 1;

	public Pawn(boolean team, BoardLocation location) {
		super(team, PAWN_VALUE, location);
	}

	public boolean isValidMove(BoardLocation dest) {
		int direction = curLoc.getMoveDirection(dest);
		int distance = curLoc.getMoveLength(dest);

		boolean validMove = true;

		if (!dest.isOnBoard()) {
			validMove = false;
		}

		//Black pawn must move down
		if (team == ChessGame.BLACK && direction != BoardLocation.DOWN
				&& direction != BoardLocation.DOWN_LEFT
				&& direction != BoardLocation.DOWN_RIGHT) {
			validMove = false;
		}

		//Black pawn must move distance of 1 or 2 if in row 1
		if (team == ChessGame.BLACK && distance != 1
				&& (distance == 2 && this.curLoc.getRow() != 1)) {
			validMove = false;
		}

		//White pawn must move up
		if (team == ChessGame.WHITE && direction != BoardLocation.UP
				&& direction != BoardLocation.UP_LEFT
				&& direction != BoardLocation.UP_RIGHT) {
			validMove = false;
		}

		//White pawn must move distance of 1 or 2 if in row 6
		if (team == ChessGame.WHITE && distance != 1
				&& (distance == 2 && this.curLoc.getRow() != 6)) {
			validMove = false;
		}

		return validMove;
	}

	public String toString() {
		return "P";
	}
}
